#import re
#import matplotlib.pyplot as pp
#def return_NM(s):
#    """
#    Returns the NM id of the string
#    """
#    pattern = "(NM_\d+)_\w+\s+chr\d+:\d+-\d+"
#    m = re.search(pattern,s)
#    if m is not None:
#        return m.group(1)
#def return_CHR(s):
#    """
#    Returns the Chr No. of the string
#    """
#    pattern = "NM_\d+_\w+\s+(chr\d+:\d+-\d+)"
#    m = re.search(pattern,s)
#    if m is not None:
#        return m.group(1)
#
#def return_MATCHES(p,s):
#    l=[]
#    for m in re.finditer(p, s):
#        if m is not None:
#            l.append(m)
#        else:
#            return None
#    return l
#
#file = open("upstream2000.fa","r")
#raw_data = file.read().replace("\n","")
#data = re.split(">", raw_data)
#list_all=[]
#l=[]
#list_three=[]
#list_two=[]
#for i in data:
#        m = return_MATCHES("t\wtcgcga\wa",i)
#        number = len(m)
#        if number <> 0:
#            if return_NM(i) is not None : list_all.append(return_NM(i))
#            if number == 3:
#                list_three.append(return_CHR(i))
#            elif number == 2:
#                list_two.append(return_CHR(i))
#            l.append(len(m))
#out = open("out.txt","w")
#for i in list_all:
#    i = i + "\n"
#out.writelines(list_all)
#out.close()
#
#print list_two
#print list_all
#pp.hist(l, 5)
#pp.show()

import upsteamator
TCT = upsteamator.Upstream("tctcgcgaga")
print TCT.return_list()
